<?php

/**
 * Kpiday filter form base class.
 *
 * @package    seth
 * @subpackage filter
 * @author     Fuz
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseKpidayFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'day'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'plant'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Plant'), 'add_empty' => true)),
      'subplant'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Subplant'), 'add_empty' => true)),
      'lastupdate' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'pr'         => new sfWidgetFormFilterInput(),
      'rad'        => new sfWidgetFormFilterInput(),
      'expen'      => new sfWidgetFormFilterInput(),
      'impen'      => new sfWidgetFormFilterInput(),
      'tmod'       => new sfWidgetFormFilterInput(),
      'tenv'       => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'day'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'plant'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Plant'), 'column' => 'id')),
      'subplant'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Subplant'), 'column' => 'id')),
      'lastupdate' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'pr'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'rad'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'expen'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'impen'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'tmod'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'tenv'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('kpiday_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Kpiday';
  }

  public function getFields()
  {
    return array(
      'id'         => 'Number',
      'day'        => 'Date',
      'plant'      => 'ForeignKey',
      'subplant'   => 'ForeignKey',
      'lastupdate' => 'Date',
      'pr'         => 'Number',
      'rad'        => 'Number',
      'expen'      => 'Number',
      'impen'      => 'Number',
      'tmod'       => 'Number',
      'tenv'       => 'Number',
    );
  }
}
